fix issue #184
use trimmed()
fixed null dereference
Merge pull request #192 from krepa098/master

Fixes (0deref, misc)