Sdb fixes 1

Pull request to fix #120 , #121 and #122.