Fix some obvious bugs