Hopefully fixed bugs from last commit