read offset and max from command line
fix bug, change or to and