Fixing run time errors