fix variable passing issues