read file input, fix exception handling