parameter check updated and error handler improved