KER-258: Fixed bugs met during the integration tests and added an example to test the scoping