Fix 'local variable 'x' referenced before assignment' error

Fixes #36

Signed-off-by: David Scott <dave.scott@eu.citrix.com>