primary key exception bug fixed