Modified the code for taking backup

Signed-off-by: Roshan Bhagat <roshanbhgt@gmail.com>