Merge pull request #11 from fsuter/master

[BUGFIX] Set fieldname in categories relations
[BUGFIX] Ensure that pid is not NULL, issue #12
Updated code base by merging upstream/master