port of code updates from kbase git