Sorry, guys. Finally worked out the issue - I'd redefined 'gl' as an integer deep in some old code - the whole project was converted from VB6 when gl had no meaning. I was searching for gl. (with a dot) to avoid other references inside longer expressions. So panic over.