various fixes to improve performance of mysql_example