Strange, I just tested it without these casts and it's fine. I thought I was previously getting a compiler error here, might have been something else. Fixing now!