Corrected some obvious bugs.