Some minor changes

IF EXIST to prevent errors.