fix compile error

Fixed the bug in the previous code, and checked the code following to erin's advice.
There seems to be no problem, and WCLength seems to be changed correctly judging from 
the log file of simulation run.