Fixing Railway Hoisting Issue

orm is defined on the var declared two lines below the if block and not on the expected global reference