Fix for null pointer closes #951