Optimizes CCLayout, fixes #370