Fixed some saving & loading errors

Fixed layers not being read properly, and a crash related to that