NullPointerException, make sure map is created before registration is done