Fixed error where state was not being passed