Hopefully fixed some code