add support for 3 top layers in memory data layer