fix cgi-bin directory handling (#1764)