Fix variable assignment issue