fix image width and height exchanging bug