Fixing bug with assignment operator