bad ref fix