Fixed null pointer exception in ButtonListener