Fixed bug in WS init