Added process.nextTick per suggestion by Christian Amor Kvalheim.