bugfix for reference problem (use deep copy)