Add new image size support. Fix some bugs