Moved debug statements to after to NULL check to stop kernel panic when tracing execution