Fixes handling HTTP status code, and backup rotation logic

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>