This whole logic has changed with the new xblock version.  See https://github.com/edx/edx-platform/pull/971.  You might want to cherry pick in that PR.