debounce problem

Well as Grumpy_Mike pointed out, you should try a larger capacitor.

Do the opposite: use as small of a capacitor as you can.