fixed bug in sql instructions