fix for https://github.com/vibou/vibou.gTile/issues/23

I'm neither a javascript programmer nor a gnome expert. But this is working very well for me. Perhaps some cleanup could be done...