Fixed some compiler issues and disposes