Fix check for invalid piece prefix