Fixed some things, namely errors writing