improved ws server with better data error support