Add  support correctly and catch flatten errors.