switch from typeof to defined?