make sure it works with mac. Generic cannot be cast to primitive types