Fixed problem: const statement not allowed inside else statement