implement ref on entry