change javascript to improve presence handling.