Cleaned up url generation, see WP Trac Issue #16953