Fixed bug with levels undefined