fix image drawing problem