add resuming support to script