fixed a bug in the remove pieces method.