fixed sql locking