Fixing bug where flagging image wouldn't un-set.