more fixes from @mrcdk and my fix for getRectangleFromTileset()