Added checkings for invalid states

Change-Id: Ibccc94091f5666dcbd0864bc7b0031563ea20638