resolving a bug in variable mutation