bug fix create_flat