Unattach old program attachments #963, should also help with #1002
Numerically sort patches in db.sh