added assertion, special case for nan types