fixing variable handing