Fixing two small code bugs