Fixing js result generation/parsing