Fix release state changes. Unit tests