Server side: added result set count. fixed nullpointer