Bug-4388 Disabled database expansion throws error 500

Bug also exists on master branch.
Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>