Fix issue with reference assignment