some minor bugs fixed