Bug fix
New approach to SQL