Saving sql is deleting last row