fixing issues with ref.s