No longer crashes when an invalid layer is given