A slightly more general fix. Fixes #43.