found the issue with initializing state