Adds missing return code checks