Fixed type safety check