fixed error where insert always returned false