Fix database version check bug