New state encoder/decoder and fixed 404 when logging in from login page