improve mysql code, elliminate warnings