looks like there's a NULL pointer dereference issue somewhere in there