Debugging more, now it seems to work