Fixes logic error in roots