fixed #6, detect input size
fixed #19, a funny sample.