Fixes NPE when return types are void

fixes #130, #139, #146