Fix undefined variable error