fixed wrong variable assignment