refactor queries in update binaries