Fixed wrong variable assignments