fixes in more robust parameteres and input checking