improve typeof usage