Added error check to depth print