Make sure commands are executed in the correct order