Mysql Query Bug Fixed