Forgot to mark a variable as volatile & removed small duplication