return null in case of invalid piece