Fix some trivial bugs