fixed bug with copying constructor