fixed a few bug noticed in 5.0.0