Callback fix and code cleanup

It's a workaround for user dynamic callbacks bug. It preserves default callbacks and cleans some duplicate callback initialization code. Hopefully it will save a day for someone.