NullPointerException fix, use new API for locations in database