fixed \fi and package issues when using certain packages