Fixes an error detecting the tables affected by a given layer