add some basic sanity checks to args to serialize scripts; fix log.json encoding issue; normalize tabs as 4 spaces