I can't believe I messed that up. Serves me right for not testing my code...