fix errors, add mysqli support