#205 removing auto unboxing to avoid NPE problems. Use  type conversions instead.