A bug fix from Ted Howards sf.net fork