update to new API
fix clean memory layers