Cef improvements

fixes #389 and #415

NOTE: this series is a candidate for the stable branch