Fixed some bugs regarding level