Fix completeIntent being called at the wrong place