fixed a nil exception error