fixed bug in variable search