Fixed various bugs which were resulting in sudden crash