better error handling
added support for inf and functions union and intersection