fixed some bugs when invalid parameters were passed