fix several bugs for running code on big red 2