fixing a bug created another bug