some modifications to ease the merge with current libelium upstream