fixed three bugs