Backported fix for #18 to IDEA 11