Added some code here for detecting initial thumbnail size.  But I'm not sure if there are better place to do this work..