Fix some trivial bugs. (in progress)