Fixed the bug that nick found.
Signed-off-by:Ed Torbett <edward@torbett.co.uk>