Submitted patch for bug 1000174, filed bugs 1000803 and 1000804