handle wrap around in readinto()

fixes #2