fix finding edge of file