replace typeof input validation with prototype.toString