fixed some bugs and added some hacks for placeholders