Merge from upstream

This is the correct fix for #13.