fixed bug when clicking button