Fixed issue when handles is null.

Signed-off-by: crynobone <crynobone@gmail.com>