refactor: more stricter type checking in condition