Add error handling to some missing functions

Change-Id: If8dee1819d493fa4b27eba99de611c61bfdfe7a3
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>