FIX: added encodeURIComponent() to log function