fixes #500 - avoid endless loop. Return null on non matching entity