fixed bug with offsets and limits.