fixed levelup function