Fixed various bug for -a option