fix inappropriate return values in lua api functions