Fixed mysql bug