Fix some quickly detected bugs.