fix smashing bug