Fixed database convert bugs