Fixed references to undefined variable