Fixed attribute affects behaviour and cleaned up onConnection method

Fixed and tested with our scripted scene.