Fix stages of image creation

Stage 1 needs to be set before spawning the async process.
Fix integration tests to new rest api