replace deprecated finite() with isfinite()