fixed bug when not using sql