Stability functions for implicit methods: fix bug and add test.