Fixes #2204
For Imagine v0.5 (previous code was for 0.6 dev)