old methos wasn't working, added new stateflag, which works