fixed major errors
more debug infomation printed