You could make this code safe for MediaDB.VERSION 4 and later now by changing

  3 != MediaDB.VERSION

3 > MediaDB.VERSION