Fix crash issues in melee.c