Fixed "Invalid database Handle 0" error.