better references handling