added generic response type and fixed NPE in response-type detection