Fixed issue #6 - Divide by zero error

Fixed an issue where the correct device count wasn't being established.
This should work properly, now.