[Rebased]: Remove use of typeof for undefined properties

Closes #692 
I've also changed this line according to the commit.