Check that state is ok
Fix table prefix