Fix API & command line parsing