delete global vars and use pickle