minor bug fix

Fixed bug where map was used before it was defined