copied fix from attachmentbot, introduced better cmd-line options