Fixed duplicate loading bug, Enhance security in sql queries