mysql extension + bug fixes + clean up