Improved error handling
Fixed an issue with circular dependency detection