some small bugs fixed