main script fixups