correct variable copy bug