fix occasional reference error