WS239 - bug fixes and tests