fixed weird crashing bug