Fix crash on folding renamed layer

Signed-off-by: Marius Avram <marius.avram1309@gmail.com>
Merge pull request #528 from marius-avram/renamed_folding_crash

Fix crash on folding renamed layer