Police apologise to man after he was imprisoned for 13 days