imporoved workaround for workaround for Objective-C passing nil for error. modified example.