fix fragile code