Fixed wrong logic in BAD31