Revert changes from 4cb62cd27b48280479a1805ecd6363f8f0d8109f properly. Fixes #324