Fixed offset bug in arg parsing, and added extra checks