Bug-4388 Disable database expansion when enabled throws Error 500

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