fix small bugs in core
update code documentation