fixed some bugs regarding using unexisting variables