Typos
removed unneeded variable
Throw an exception when the alignment is invalid