Fix possible segfault depending on memory location...
Fix tests