Bug fix

Moved map declaration to top of script