fix #52, now can accept a file as input