fixed bad SQL call