FIX use instanceof to check if is error