fixed another bug due to lack of cloning and wrong datatype