fix issues with state parameter