Refactor the way user is retrieved from session. It now catches the old way it was saved (as the actual user model), changes to the new way (user id) and then updates the cookie too.
I wonder if it's model who saves ids and longs or request.session.