Fix javascript scope issue causing markers to not get added to map