improve constraints to handle pk and fk