Fix variable look-up error when calling function from interrupt