fix for stackoverflow on db upgrade