fix insert to mysql and better output