slight logic and linking fixes