fix #25: flatten layers of multilayers images