You didn't do anything wrong.
PS and/or PowerCLI sometimes get garbage in the objects they keep in memory.
That message you got is in a lot of the cases by such a mishap.
A stop/start of the session lets you start afresh.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference