Troubleshooting checkConnection() and it's conflict with history.back()