Fixed error with external database