Bugfix regarding depth queries and better error handling.