PIM-1255 : fix tree exists and fix code violation