fixing bugs for all code