added maxsize to C-struct; fixed allocation issue