Minor bugfixes and type conversions.