fixing silly mistake - typeof isn't for checking undefined