Fixed an error when generating the secure pieces