Fixed error in SQL escaping