database encoding bug fixed