fixing variable replace