Fixed bug with crash