changed offset() to position() in getDims()