added some null checks for debug