Corrected handling of return value

Also changed it to be of my preference ;)

Signed-off-by: Ilya Mikhaltsou <morpheby@gmail.com>