cosmetics changes
throw error when source size is too small + other fixes