fix bug with overwrite logic
remove input and fix output logic