first attempt at fixing the w-bug, todo: test