fix bug in recursive subroutine call in ws.py