After solving this problem I'll add a debounce for the pushbuttom
No, you've got the steps in the wrong order. Stop the button from bouncing, and you may not have the other problem.
Post all of your code, too. It's impossible to tell what you are doing wrong with just that snippet.