* fix: avoids crashing when selected_action is null * fix: more robust handling suggested by @straton