core dump when complied with gcc, now fixed, also style update