fixed possible unsafe SQL statement