Merge pull request #315 from ddobrev/master

Compared types directly instead of their string representations
Fixed the generation of a null check before returning a value.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>