Bugfixes and argument parsing