Why coniditions are not working?