Bug that prevented some native commands from being executed by some commands listeners fixed

Bug that prevented some native commands from being executed by some
commands listeners fixed; Plus some code cleaning up.