Fixing migrations + some bugfixes