Fixed table existence query and deleted unneccesary check