Fixed bug when orElse(function) would always return its value even if type was matched