fixed cloning of objects to work with arrays