fixed map to take care ofempty database