query.py: Fixed script_fields serialization if dict. Closes #409