Fixed a piece substitution bug