Testing gradient functions and lines and discovery of seg-fault in bmp_free for large bmps