Code Refactoring & Bug fixed.

#comment PB-745 fixed.
test error fixed.
Merge commit '0264365c7e62278901f936140a4f5ef8e10b3d18' into HEAD