Better fix for URL encoding bug