Bugfixes & split between mysql_connect & h_apps