Fixed some bugs which occured within an empty database