fixed #1 adding cast for type incompatibility