Issue #291

Casting and conversion where possible.