segfault 11, but cleaned up many warnings