fix setting stream position

an error occured if the positon was the full length of the file