Fix some bug in WSMethodDescrTable creation.
Code structure refactoring.