Minor fix: throwing the correct exception