slub: patches taken from imoseyon