fixed a bug that causes a nullpointer exception when returning a result