Prevent javascript error when no query string is present