Fixed problem with faulty table or gender name for table queries