fixing amazon instance foreign key problem