Hopefully fixed Seg Fault Error

Please check with GDB.