Port bem-pr 0.3.5 changes