Fix double check
Original author:  andi34