> But can't currently find any bug in my definitions. Here is the working simplified example:

By saying "working" here, you mean that the example you posted works correctly or it reproduces the problem you described?