fixing small crash bugs