fixed crash and few other small issues