Fix double-checking bug