Fixed tests bugs