Fixed a fatal bug brought to surface by Node 0.10.0

Also fixes a bug when a file is required multiple times
in one file, only the first got resolved.

Signed-off-by: Ozan Turgut <oturgut@turn.com>