Don't go into an infinite loop.

Fix for #86.