Fixing data retrieve bug