move sanity checking of selected layer