Fixes of my previous pull request

Accidentally made a typo and switched `is_connected` with `was_connected`.