Fix register callbacks in some cases