Ironed out the level up lua function against missing data.

I also fixed the level cap applied only when doing a new game,
not when resuming a game.

Thanks a lot to Shirish for pointing out.

Closes #161