Add StateReturn and fix build script.