added sanity check for handle