more explict type check for error