Fix $im not defined