moved return statement to the correct place
closes #643