Fixed possible null reference (Issue #196)