It was an error how index of requested layer was searching: iterating used to start from the beginning of data layers datablock, not from index at which requested layer type actually begins.
It was an error how index of requested layer was searching: iterating used to start from the beginning of data layers datablock, not from index at which requested layer type actually begins.