Ugly hacks to make everything work