Possible fix to crash
Fixed nil pointer that caused program to crash