(fixes #127) type casting bug