fixed javascript not adding query parameters correctly