fixed some bugs found tdy in lab