Fixed mysql problems