more testing and make more testable
fix a potential bug