database load bug fix and other minor fixes