minor

Add more type guards.