Bug fixes

Fixed query bug when identifying agent/actor in database.
Fixed issue when using pure PUT for statements and activity states as
opposed to IEmode using POST only.
cleanup