Yet another try to get refs right