libtremor: merge upstream revision 17528-17530, more error checking and bug fixes