Fix run() to handle result from function correctly