Read marketvercode to get stable version
diff --git a/update.sh b/update.sh
index ece2732..0fd0d16 100644
--- a/update.sh
+++ b/update.sh
@@ -34,7 +34,8 @@
 		wget $repo/index.jar -O tmp/index.jar
 		unzip -p tmp/index.jar index.xml > tmp/index.xml
 	fi
-	apk="$(xmlstarlet sel -t -m '//application[id="'"$1"'"]/package[1]' -v ./apkname tmp/index.xml)"
+	marketvercode="$(xmlstarlet sel -t -m '//application[id="'"$1"'"]' -v ./marketvercode tmp/index.xml || true)"
+	apk="$(xmlstarlet sel -t -m '//application[id="'"$1"'"]/package[versioncode="'"$marketvercode"'"]' -v ./apkname tmp/index.xml || xmlstarlet sel -t -m '//application[id="'"$1"'"]/package[1]' -v ./apkname tmp/index.xml)"
 	wget $repo/$apk -O bin/$apk
 	addCopy $apk $1 "$2"
 }