fixed bugs.

fixed bugs thorowing assertion error.