Fixed three bugs.