foreign keys fix + saving results