handle bad ref