Fixed leaf bugs