fix return value handling