Fixes issue with variable type being undefined

Prevents undefined variable error on line 144 from happening and fixes issue #7