fixes check if user exist before insert , update cookie