changed assert()'s to if's when NDEBUG is defined