Optimizations for MySQL

Made it only run status() when the query fails, that way it doesn't run it every time.