Fixes not yet in upstream for IDEA compatibility