Fixed error caused by empty layers. They are for now ignored