fix use of SEEK_BEGIN