updated conditional check on visible dynamic layers