Add checks and return value in operator=