rename getState function
General bugfixing