optimise the mysql handler a bit