fixed different issues with button clicking