Fix testing bugs