Correcting segfault during ws