refactor: stricter type checking in conditions