Fixed return value bug

Signed-off-by: Mike Griffiths