Fixed some mapping and table bugs