Implement checking for NULL handles