Fix a potential null pointer for issue 394