prog_mem rewrite