Database::escape_string; bugfix of error handling