fix immature termination of geometry optimization
fix test errors