bugfix on memory layout