Fix for NPE in the dao