Added a check for NaN in forward

Fixes the bug where impossible observed sequences cause the c sequence
to become NaN