weird seg fault locations and output based on input