added error checking for qtree creation