fix return statements bug