Fixing notices.
Ported changes from 1.5.6.x branch.