Fix bug with isAlive() function