small optimazation.
Fixed segfault, mostly.