Fix double check and a minor bug