Fixed memory corruption bug in opt_rmunused