added support for NSError code.