Damion, have you tried using the plugin with the disable_path_info option turned on? Some servers (that do not support CGI PATH_INFO) will only work in that mode, and it totally changes how URLs are generated. This code assumes that mode isn't active.