fix for #349 mixed types

- see bug #349 
- changed return type to int