Tried various things related to avoiding trouble with scale and offset
Change to avoid some unnecessary type checks