Various bug fixes in argument handling