Fix a problem in main(), add tests

Signed-off-by: Kai Blin <kai.blin@biotech.uni-tuebingen.de>