fix assigning of garbage or undefined value