Fixed logic error in link saving.