fixing usage of `if(undefined>=0)`

The condition `if(fr >= 0) {` can be used with `fr=undefined`. In general `undefined>=0` is false, but initializing of `fr` to `-1` seems me more reasonable.