Removed if statement which was interfering with query