cast NULL to correct type