clean up, minor bugs correction