Fix bugs and add resize after loaded image