Fix bugs introduced in last pull request.