Fix failures on 4.1.0.beta1

This fixes callback compile failures on 4.1.0.beta1 and module load
failures while maintaining backwards compatibility for 4.0.x series.

[ close #3475 ]