Fixed nullpointererror on toggle button click