Fixing buggy code for injecting and running commands by Servlet object