Fix multiple small bugs.