Changed error message for log file
Fixed finding objects without depth and building sql query