Fix bug with storage search.
clean code
Protect against NPE