Fix firefox bug during map loading

"Too much recursion" error fixed using a setTimeout sometimes.