Make sure you have very few points right before returning the crystal to the palace. Returning a crystal automatically takes you to your next level. So, if you are only a few points away from your next level up, kill a few more enemies first to reach that level before returning the crystal. Otherwise, you waste a level up.