[#issue-421] apply review and fix broken test suite

@kami I applied your review to code with our best approch.

and fix testcase that were broken because of changing.

please review this. Thank you for your advice..