intermidiate commit, some bug fixs.