Fixes a bunch of notices & errors generated during normal operation.