clone map to make sample immutable

Currently command is passed to sample as a pointer, so changing command will change the data within sample.

This change will make a copy of command before passing to sample, hence sample is now immutable