bugfix: was missing a return in an error check