added diagnostics to scripts