Fix to rewind filepointer when testing BOM marker