Core: make sure remote is executed last

Fixes gh-711
Closes gh-807