Improved error reporting
Fixed complex square root