Fixed NPE on tool check
Improved SQL storage